
#include "rtps/storages/CacheChange.h"

struct rtps_CacheChange *
rtps_CacheChange_init( void )
{
    struct rtps_CacheChange *cc = (struct rtps_CacheChange *)calloc(1, sizeof(struct rtps_CacheChange));

    if (cc == NULL)
        return NULL;

    cc->kind = INVALID;
    cc->sequenceNumber.high = -1;
    cc->sequenceNumber.low = 0;

    cc->data = rtps_PBufWrapper_Construct(RTPS_PBW_BY_LENG, 0);
    if (cc->data == NULL) {
        free(cc);
        return NULL;
    }

    return cc;
}

void
rtps_CacheChange_deinit( struct rtps_CacheChange *cc )
{
    if (!cc)
        return;
    rtps_PBufWrapper_Destruct(cc->data);
    free(cc);
}
